package ext;

public class TimeStampToDate {
    
    public static String toDate(long timestamp) {
        long year = 365 * 24 * 3600 * 1000;
        long ys = timestamp / year;
        long mills = timestamp % year;
        long day = 24 * 3600 * 1000;
        long ds = mills / day;
        long curYear = 1970 + ys;
        if (ds <= 31) {
            return curYear + "-01";
        }
        ds -= 31;
        if (curYear % 4 == 0 && curYear % 100 != 0) {
            if (ds <= 31) {
                return curYear + "-01";
            }
        }
        return null;
    }

}
